home *** CD-ROM | disk | FTP | other *** search
-
- #import "WWButtonCell.h"
- #import "WWButtonCellIBInspector.h"
-
- @implementation WWButtonCellIBInspector
-
- - init
- {
- char buf[MAXPATHLEN + 1];
- id bundle = [NXBundle bundleForClass:[WWButtonCell class]];
-
-
- [super init];
-
- controlStringSize = 256;
- controlString = (char *)NXZoneCalloc([self zone], controlStringSize, sizeof(char));
-
- tclExpressionSize = 256;
- tclExpression = (char *)NXZoneCalloc([self zone], tclExpressionSize, sizeof(char));
-
- [bundle getPath:buf forResource:[[self class] name] ofType:"nib"];
- [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
-
- // since the textView was "hidden" inside the ScrollView, we couldn't do this in IB, so...
- [theControlStringText setDelegate:self];
- [theTclExpressionText setDelegate:self];
-
- [self revert:self];
-
- return self;
- }
- //
- - free
- {
- if (controlString) { NXZoneFree([self zone], controlString); }
- if (tclExpression) { NXZoneFree([self zone], tclExpression); }
- return [super free];
- }
- //
- - revert:sender
- {
- [theControlStringText setText:[object controlString]];
- [theTclExpressionText setText:[object tclExpression]];
- [theTclVar setStringValue:[object tclVar]];
- return [super revert:sender];
- }
- //
- - ok:sender
- {
- int cnt;
-
- cnt = [theControlStringText textLength];
- while (cnt >= controlStringSize)
- { controlStringSize *= 2;
- controlString = (char *)NXZoneRealloc([self zone], controlString, controlStringSize);
- }
- *controlString = '\0';
- [theControlStringText getSubstring:controlString start:0 length:(cnt + 1)];
- [object setControlString:controlString];
-
- cnt = [theTclExpressionText textLength];
- while (cnt >= tclExpressionSize)
- { tclExpressionSize *= 2;
- tclExpression = (char *)NXZoneRealloc([self zone], tclExpression, tclExpressionSize);
- }
- *tclExpression = '\0';
- [theTclExpressionText getSubstring:tclExpression start:0 length:(cnt + 1)];
- [object setTclExpression:tclExpression];
-
- [object setTclVar:[theTclVar stringValue]];
-
- return [super ok:sender];
- }
- //
- - (BOOL)wantsButtons { return YES; }
-
- // text delegate methods
- - textDidChange:sender { return [self touch:sender]; }
-
- @end
-